package com.iteaj.network.test;

import com.iteaj.network.test.server.line.LineBasedFrameDecoderComponent;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@ConditionalOnExpression("${iot.test.client}")
@EnableConfigurationProperties(IotTestProperties.class)
public class IotTestAutoConfiguration {

    private IotTestProperties properties;

    @Bean
    @ConditionalOnExpression("${iot.test.server}")
    public LineBasedFrameDecoderComponent lineBasedFrameDecoderComponentTest() {
        return new LineBasedFrameDecoderComponent(properties.getLine());
    }

}
